import settings from '@/settings'
const getStyleValue = <T>(value: T): T => {
  if (typeof value === 'number' || typeof value === 'undefined') {
    return value
  }
  if (typeof value === 'string' && value.indexOf('var') > -1) {
    const arr = value.match(/^var\(([\w-_]*?)\)$/)
    if (arr && arr[1]) {
      return settings.css[arr[1]]
    } else {
      return value
    }
  } else {
    return value
  }
}

export default getStyleValue
